<template>
  <div class="main">
    <!-- <p class="hero-tagline">
      My name comes from the Latin "lumen", which means light. It represents AI chat software as a
      light that can illuminate people's journey and help them acquire knowledge and information
    </p> -->
    <!-- <a-button type="primary" @click="scrollToBottom">add</a-button> -->
    <div class="bubbleList">
      <bubble v-for="(i, k) in chatList" :item="i" :key="k" :message="i.content" :is-user="i.isUser"
        :error="i.sendError" />
      <div class="ai-loading">
        <!-- <span class="tip">loading</span> -->
        <loading v-if="chatStore.loading" />
      </div>
      <a-divider v-if="chatStore.isEnd"><span class="divider-text">last chat {{ DateUtils.formatTimestampToDate(chatList[chatList.length - 1].timestamp, 'yyyy/MM/dd HH:mm:ss') }}</span></a-divider>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue';
import DateUtils from '@/utils/dateUtils';
import loading from '@/components/loading.vue'
import { LoadingOutlined, RobotOutlined } from '@ant-design/icons-vue'
import bubble from '@/components/bubble.vue'
// import { ref, watch } from 'vue'
import useChatStore from '@/store/chatStore';
// import { theme } from 'ant-design-vue'
const chatStore = useChatStore()
const chatList = chatStore.currentChatList
</script>

<style lang="less" scoped>
.divider-text {
  font-size: 12px;
  color: #969696;
  user-select: none;
}

.main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.bubbleList {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;

  .ai-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: .3125rem;

    .tip {
      color: #969696;
    }

    // height: 100px;
  }
}
</style>